#!/bin/bash
# Author: liuxu
# Date: 2025/8/21
# Description: rccl自带测试集UT
# Usage method: ./rccl_test.sh

set -x
# docker run -itd  --name=liuxu_test_rccl --privileged -v /sys/kernel/debug:/sys/kernel/debug:ro --device=/dev/kfd --device=/dev/mkfd --device=/dev/dri --shm-size=16G --group-add video --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -v /opt/hyhal:/opt/hyhal:ro -v /construct02/dtk/dtk-25.04.1:/opt/rocm -v /construct02/home/liuxu/:/liuxu_test/ 10.15.3.8:5000/rccl_mpi_img:v1.0 /bin/bash

git clone -b dtk-25.04.1 http://root:glpat-tWyMPqC9_3PVzz9kcoBB@10.15.3.7/dcutoolkit/deeplearing/rccl.git

export CXX=${ROCM_PATH}/bin/hipcc
export HSA_FORCE_FINE_GRAIN_PCIE=1

cd rccl
rm -rf build
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=${ROCM_PATH} -DAMDGPU_TARGETS="gfx906;gfx926;gfx928;gfx936" -DBUILD_TESTS=ON -DROCM_PATH=$ROCM_PATH ..
make -j$(nproc)

# 测试功能用例
./rccl-UnitTests --gtest_filter=-Performance* > func.log 2>&1

